package com.yunduansing.demo.service.impl;

import com.yunduansing.demo.entity.ButtonEntity;
import com.yunduansing.demo.mapper.ButtonMapper;
import com.yunduansing.demo.service.ButtonService;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author yunduansing
 * @since 2020-05-24
 */
@Service
public class ButtonServiceImpl extends ServiceImpl<ButtonMapper, ButtonEntity> implements ButtonService {
    @Autowired
    private ButtonMapper mapper;

    @Transactional(rollbackFor = Exception.class)
    @Override
    public boolean save(List<ButtonEntity> entity) {
        mapper.deleteByMenuId(entity.get(0).getMenuId());
        saveBatch(entity);
        return true;
    }

}
